﻿@{
    Layout = "~/Views/Shared/_LayoutForm.cshtml";
}
<div class="col-xs-12">
    <form id="editForm" class="form-horizontal" role="form">
        <div class="alert alert-warning" id="msgAlert">
            <span id="spErrorMsg"><i class="ace-icon fa fa-exclamation-circle"></i>  初始密码为888888</span>
        </div>
        <div class="form-group">
            <label class="col-xs-2 control-label no-padding-right" for="Name"> 用户名 </label>
            <span class="col-xs-7">
                <input field="Name" type="text" id="Name" name="Name" class="col-xs-12" placeholder="用户名" check-type="required" />
            </span>
        </div>
        <div class="form-group">
            <label class="col-xs-2 control-label no-padding-right" for="Name"> 邮箱 </label>
            <span class="col-xs-7">
                <input field="Email" type="text" id="Email" name="Email" class="col-xs-12" placeholder="邮箱" check-type="mail" />
            </span>
        </div>
        <div class="form-group">
            <label class="col-xs-2 control-label no-padding-right" for="Name"> 联系方式 </label>
            <span class="col-xs-7">
                <input field="Phone" type="text" id="Phone" name="Phone" class="col-xs-12" placeholder="联系方式" />
            </span>
        </div>
        <div class="form-group">
            <label class="col-xs-2 control-label no-padding-right" for="Name"> 真实姓名 </label>
            <span class="col-xs-7">
                <input field="RealName" type="text" id="RealName" name="RealName" class="col-xs-12" placeholder="真实姓名" />
            </span>
        </div>
        <div class="form-group">
            <label class="col-xs-2 control-label no-padding-right" for="IsVisible"> 是否有效 </label>
            <span class="col-xs-7">
                <input type="checkbox" ctype="switch" id="IsVisible" name="IsVisible" field="IsVisible" data-size="small" data-off-text="No" data-on-text="Yes">
            </span>
        </div>
        <div class="form-group">
            <label class="col-xs-2 control-label no-padding-right" for="Remark"> 备注 </label>
            <span class="col-xs-7">
                <textarea field="Remark" id="Remark" name="Remark" class="col-xs-12" maxlength="200"></textarea>
            </span>
        </div>
        <div class="form-group">
            <label class="col-xs-2 control-label no-padding-right" for="Remark">所属角色</label>
            <div class="col-xs-7">
                <div id="selectRoles"></div>
            </div>
        </div>
        <input type="hidden" id="Id" name="Id" field="Id" />
        <input type="hidden" id="Password" name="Password" field="Password" />
    </form>
</div>
<script type="text/javascript">
    $(function () {
        //alert($("#Id").val());

        xcore.initForm($("#editForm"));

        $("#editForm").validation(function (obj, params) {
            if (obj.id == 'Name') {
                var name = $("#Name").val();
                var Id = $("#Id").val();
                $.post("CheckAccountIsExists", { Name: name, Id: Id }, function (data) {
                    params.err = !data.success;
                    params.msg = data.message;
                });
            }
        });
    });
</script>